﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PRO.Entity;
using PRO.DbProvider;
using PRO.ORM;

namespace PRO.Product
{
    public class DeliverLib
    {
        /// <summary>
        /// 添加收货地址
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static bool AddDeliver_Address(Deliver_address_Info info)
        { 
            return DataBaseProvider.GetInstance().AddDeliver_Address(info);
        }
        /// <summary>
        /// 获取我的收货地址
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static List<Deliver_address_Info> GetMyDeliver_Address(int userid)
        {
            List<Deliver_address_Info> list = new List<Deliver_address_Info>();
            list.BindDataToEntity(DataBaseProvider.GetInstance().GetMyDeliver_Address(userid));
            return list;
        }
        /// <summary>
        /// 获取收货地址
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static Deliver_address_Info GetDeliver_Address(int id, int userid)
        {
            Deliver_address_Info info = new Deliver_address_Info();
            info.BindDataToEntity(DataBaseProvider.GetInstance().GetDeliver_Address(id,userid));
            return info;
        }
        /// <summary>
        /// 设置默认收货地址
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool SetDefault(int id,int userid)
        {
            return DataBaseProvider.GetInstance().SetDefault(id,userid);
        }
        /// <summary>
        /// 删除收货地址
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static bool DelDeliver_Address(int id, int userid)
        {
            return DataBaseProvider.GetInstance().DelDeliver_Address(id, userid);
        }
    }
}
